package rs.webnet.android.kamere;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.preference.PreferenceManager;

public class PreferencesManager {
	public static long getRefreshTime(Context con){
		SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(con);
		return Long.parseLong(sp.getString("refresh_time", "0"));
	}
	public static double getRadius(Context con){
		SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(con);
		return Double.parseDouble(sp.getString("radius", "0.2"));
	}
	public static boolean getUseGps(Context con){
		SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(con);
		return sp.getBoolean("use_gps", false);
	}
	public static boolean getWifiOnly(Context con){
		SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(con);
		return sp.getBoolean("wifi_only", false);
	}
	public static boolean getIsNotificationEnabled(Context con){
		SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(con);
		return sp.getBoolean("notif_enable", false);
	}
	public static void setNotificationEnabled(Context con){
		SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(con);
		Editor editor=sp.edit();
		editor.putBoolean("notif_enable", true);
		editor.commit();
	}
	public static boolean getIsSoundEnabled(Context con){
		SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(con);
		return sp.getBoolean("sound_enable", false);
	}
	public static void setSoundEnabled(Context con){
		SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(con);
		Editor editor=sp.edit();
		editor.putBoolean("sound_enable", true);
		editor.commit();
	}
	public static boolean getIsVibrationEnabled(Context con){
		SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(con);
		return sp.getBoolean("vibration_enable", false);
	}
	public static void setVibrateEnabled(Context con){
		SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(con);
		Editor editor=sp.edit();
		editor.putBoolean("vibrate_enable", true);
		editor.commit();
	}
	public static void setNotificationDisabled(Context con){
		SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(con);
		Editor editor=sp.edit();
		editor.putBoolean("notif_enable", false);
		editor.commit();
	}
}
